terraform {
  backend "s3" {
    endpoint = "https://s3.deeproute.cn:9000"
    bucket = "terraform"
    key = "prod-data/services/initial-system"
    region = "main"
    skip_credentials_validation = true
    skip_metadata_api_check = true
    skip_region_validation = true
    force_path_style = true
  }
}

module "init_system" {
  source = "git@code.deeproute.ai:deeproute/ops-terraform.git//ansible_provisioner?ref=module.v1.0.1"

  arguments = [
    "--user=devops",
    "-b",
    "-i hosts.yml"
  ]
  envs      = [
    "host=all",
    "ansible_python_interpreter=/usr/bin/python3"
  ]
  playbook  = "../../../playbooks/common/init-system-v2.yml"
  dry_run   = false
}

module "install_expontech-csi-dependencies-services" {
  source = "git@code.deeproute.ai:deeproute/ops-terraform.git//ansible_provisioner?ref=module.v1.0.1"

  arguments = [
    "--user=devops",
    "-b",
    "-i hosts.yml"
  ]
  envs      = [
    "host=work_node",
    "ansible_python_interpreter=/usr/bin/python3"
  ]
  playbook  = "../../../playbooks/projects/site-expontech-csi-dependencies.yml"
  dry_run   = false
}

module "set_ethernet_irq_affinity" {
  source = "git@code.deeproute.ai:deeproute/ops-terraform.git//ansible_provisioner?ref=module.v1.0.1"

  arguments = [
    "--user=devops",
    "-b",
    "-i hosts.yml"
  ]
  envs      = [
    "host=all",
    "ansible_python_interpreter=/usr/bin/python3"
  ]
  playbook  = "../../../playbooks/projects/site-set-irq-affinity-for-nics.yml"
  dry_run   = false
}

# module "set_network_mtu" {
#   source = "git@code.deeproute.ai:deeproute/ops-terraform.git//ansible_provisioner?ref=module.v1.0.1"

#   arguments = [
#     "--user=devops",
#     "-b",
#     "-i hosts.yml"
#   ]
#   envs      = [
#     "host=all",
#     "ansible_python_interpreter=/usr/bin/python3"
#   ]
#   playbook  = "../../../playbooks/projects/site-network-mtu.yml"
#   dry_run   = false
# }


# module "set_iscsi-initial-name" {
#   source = "git@code.deeproute.ai:deeproute/ops-terraform.git//ansible_provisioner?ref=module.v1.0.0"

#   arguments = [
#     "--user=devops",
#     "-b",
#     "-i hosts.yml"
#   ]
#   envs      = [
#     "host=work_node",
#     "ansible_python_interpreter=/usr/bin/python3"
#   ]
#   playbook  = "../../../playbooks/projects/site-iscsi-name.yml"
#   dry_run   = false
# }